package cn.itsource.pojo.ro;

import cn.dev33.satoken.stp.StpUtil;
import cn.itsource.pojo.domain.Contact;
import cn.itsource.pojo.domain.Drcard;
import cn.itsource.pojo.domain.DriverAuthMaterial;
import cn.itsource.pojo.domain.Idcard;
import cn.itsource.service.IDriverService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

@Data
public class DriverAuthMaterialRo {
    private Idcard idcard;
    private Drcard drcard;
    private Contact contact;
    private String driverId;


    public static DriverAuthMaterial todriverAuthMaterialRo(DriverAuthMaterialRo driverAuthMaterialRo) {


        DriverAuthMaterial driverAuthMaterial = new DriverAuthMaterial();
        driverAuthMaterial.setId(Long.valueOf(driverAuthMaterialRo.driverId));
        driverAuthMaterial.setName(driverAuthMaterialRo.idcard.getName());
        driverAuthMaterial.setGender(driverAuthMaterialRo.idcard.getSex());
        driverAuthMaterial.setIdNumber(driverAuthMaterialRo.idcard.getIdNumber());
        driverAuthMaterial.setBirthday(Idcard.getbirthday(driverAuthMaterialRo.idcard.getBirthday()));
        driverAuthMaterial.setIdcardAddress(driverAuthMaterialRo.idcard.getIdcardAddress());
        driverAuthMaterial.setIdcardExpire(Idcard.getIdcardExpire(driverAuthMaterialRo.idcard.getIdcardExpire()));
        driverAuthMaterial.setIdcardFront(driverAuthMaterialRo.idcard.getIdcardFront());
        driverAuthMaterial.setDrcardIssueDate(Drcard.getDrcardIssueDate(driverAuthMaterialRo.drcard.getDrcardIssueDate()));
        driverAuthMaterial.setIdcardBack(driverAuthMaterialRo.idcard.getIdcardBack());
        driverAuthMaterial.setIdcardHolding(driverAuthMaterialRo.idcard.getIdcardHolding());
        driverAuthMaterial.setCarClass(driverAuthMaterialRo.drcard.getCarClass());
        driverAuthMaterial.setDrcardExpire(Drcard.getDrcardExpire(driverAuthMaterialRo.drcard.getDrcardExpire()));
        driverAuthMaterial.setDrcardFront(driverAuthMaterialRo.drcard.getDrcardFront());
        driverAuthMaterial.setDrcardBack(driverAuthMaterialRo.drcard.getDrcardBack());
        driverAuthMaterial.setDrcardHolding(driverAuthMaterialRo.drcard.getDrcardHolding());
        driverAuthMaterial.setCreateTime(new Date());
        driverAuthMaterial.setPhone(driverAuthMaterialRo.contact.getPhone());
        driverAuthMaterial.setEmail(driverAuthMaterialRo.contact.getEmail());
        driverAuthMaterial.setContactName(driverAuthMaterialRo.contact.getContactName());
        driverAuthMaterial.setContactPhone(driverAuthMaterialRo.contact.getContactPhone());
        driverAuthMaterial.setDriverId(Long.valueOf(driverAuthMaterialRo.driverId));
        return driverAuthMaterial;
    }

}
